//代码源于：[xyz]https://gitee.com/xyzqwefd
//配合经修改的特定分支使用https://gitee.com/xyzqwefd/ZZZ-Plugin
//缺什么的话自己导吧

export default class Button {
  constructor () {
    this.plugin = {
      name: 'zzz-plugin',
      dsc: 'zzz-plugin',
      priority: 95,
      rule: [
        {
          reg: `#绝区零更新面板|#绝区零面板更新|#绝区零刷新面板|#绝区零面板刷新$`,
          fnc: 'profile1',
        },
        {
          reg: '#绝区零帮助|%帮助$',
          fnc: 'help',
        },
        {
          reg: `#绝区零(.*)面板(.*)$`,
          fnc: 'handleRule',
        },
      ]
    }
  }
  
  profile1(e) {
    const roleList = global.zzzroleList
    const button = []

    const list3 = [
      { label: `更新面板`, callback: `/绝区零更新面板` },
      { label: '绑定UID', data: `/绝区零绑定` },
      { label: '扫码绑定', callback: `/扫码绑定` },
    ]
    button.push(...Bot.Button(list3))

    const list1 = []
    for (let role of roleList) {
      list1.push({ label: role, callback: `/绝区零${role}面板` })
    if (list1.length === 12) {
      break 
  }
}
    button.push(...Bot.Button(list1, 3))
    return button
  }

  handleRule (e) {
    const charName = e.msg.replace(/#绝区零|面板/g, '')
    let game = ''
    if (e.game === 'sr' || e.isSr) {
        game = '星铁'
    } else if (e.game === 'zzz' || e.isSr) {
        game = '绝区零'
    }

    const button = []
    const list =[
      [
        { label: `更新面板`, callback: `/绝区零更新面板` },
        { label: '绑定UID', data: `/绝区零绑定` },
        { label: '扫码绑定', callback: `/扫码绑定` },
      ]
    ]
    button.push(...Bot.Button(list, 3))
    const list2 = [
      [
        { label: `${charName}面板`, callback: `/绝区零${charName}面板` },
        { label: `${charName}攻略`,callback:`/绝区零${charName}攻略` },
      ],[
        { label: `绝区零帮助`,callback:`/绝区零帮助` },
      ]
   ]
   button.push(...Bot.Button(list2))
   return button
  }

  help () {
    const button = [
      [
        { label: '签到', callback: `/签到` },
        { label: '体力', callback: `/体力` },
        { label: '深渊', callback: `/绝区零深渊` },
      ],[
        { label: '个人信息', callback: `/绝区零个人信息` },
        { label: '练度统计', callback: `/绝区零练度统计` },
        { label: '上期深渊', callback: `/绝区零上期深渊` },
      ],[
        { label: '更新面板', callback: `/绝区零更新面板` },
        { label: `绑定UID`, data: `/绝区零绑定` },
        { label: '扫码绑定', callback: `/扫码绑定` },
      ],[
        { label: '更新抽卡记录', callback: `/绝区零更新抽卡记录` },
      ],[
        { label: '填满呐呐' , link: 'https://afdian.com/a/ye3011'},
        { label: '反馈群聊' , link: 'http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=dGwUMbO9IBj9TPGmGLmZ1HMBw5b6zaTK&authKey=e9KIcoWA2QVtQ2N0%2BBIzF3DzyR7JoSwSZkNPkXc4aI6nKzO%2Bl9KAmd%2FQ5ZXtMB4b&noverify=0&group_code=692425673'},
      ]
    ]
    return Bot.Button(button)
  }
}